// 管理这个项目的所有接口
import axios from "./requset"

// 请求首页数据
export const GetHomeData = () => axios.get("/index/index");

// export const GetHomeData = function(){
//   return axios.get("/index/index");
// }

// 请求历史记录和热门搜索 （get请求无参数的写法）
export const GetHishotData = () => axios.get("/search/index");


// 请求搜索提示列表  (get请求携带参数的写法)
export const GetSearchTipsData = (params) => axios.get("/search/helper", { params });
// export const GetSearchTipsData = (val) => axios.get("/search/helper",{
//   params:{
//     keyword:val,
//   }
// });

// 请求搜索产品列表信息
export const GetGoodsListData = (params) => axios.get("/goods/list", { params });

// 请求清除历史记录
export const ClearHistory = () => axios.post("/search/clearhistory");

// 发起登录请求
export const ToLogin = (params) => axios.post("/auth/loginByWeb", params);


// 请求详情页数据   /goods/detail
export const GetGoodsDetail = (params) => axios.get("/goods/detail", { params });

// 请求相关产品  /goods/related
export const GetGoodsRelated = (params) => axios.get("/goods/related", { params });


// 发起购物车请求  /cart/goodscount
export const GetCartNum = () => axios.get("/cart/goodscount");


// 加入购物车请求  /cart/add
export const ToAddCart = (params) => axios.post("/cart/add", params);

// 购物车列表数据的请求 /cart/index
export const GetCartData = () => axios.get("/cart/index");


// 购物车中点击每一项商品发起请求
export const chanGoodsChecked = (params) => axios.post("/cart/checked", params);


// 购物车步进器的请求
export const stepNum = (params) => axios.post("/cart/update", params);

// 购物车删除功能
export const DelGoods = (params) => axios.post("/cart/delete", params);